package com.hz.Tech2Real.yeyouwang.web;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Tech2RealHSerclet extends HttpServlet{

	private static final long serialVersionUID = 8984137821575983218L;
	
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		this.doPost(request, response);
		
	}
	
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		
		String Verifications = request.getParameter("Verifications");
		System.out.println(Verifications);
		int Verifcations = Integer.valueOf(Verifications);
		System.out.println(Verifcations);
		
		int codes1 = (Integer) request.getSession().getAttribute("codes1");
		System.out.println(codes1);
		if(codes1 == Verifcations){
			response.getWriter().print("<script>alert('验证成功');location.href='login.jsp';</script>");

		}else{
			
			response.getWriter().print("<script>alert('验证失败');location.href='login.jsp';</script>");

		}
	}
	
}
